Skip to content

Make code.jelly compatible with CSP in Jenkins 2.539+#458

Merged
timja merged 2 commits intojenkinsci:masterfrom
daniel-beck:csp-compatibility
Dec 16, 2025
Merged

Make code.jelly compatible with CSP in Jenkins 2.539+#458
timja merged 2 commits intojenkinsci:masterfrom
daniel-beck:csp-compatibility

Conversation

@daniel-beck
Copy link
Member

Fixes #456.

Since code is no longer both an inline version of file and the code to execute (the new attribute callback does the latter), we no longer need the executable attribute to distinguish, so I removed that.

This issue currently already affects weekly.ci.jenkins.io due to jenkins-infra/helpdesk#4881. So getting this change in would be useful.

Testing done

Installed csp plugin, dialogs and notification sample code execution works even when CSP is enforced.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@daniel-beck daniel-beck requested a review from a team as a code owner December 15, 2025 23:17
@daniel-beck
Copy link
Member Author

00:22:23  [INFO] Checking formatting...
00:22:24  [INFO] [warn] src/main/resources/io/jenkins/plugins/designlibrary/Notifications/adjunct.js
00:22:24  [INFO] [warn] src/main/resources/io/jenkins/plugins/designlibrary/sample.js
00:22:25  [INFO] [warn] Code style issues found in 2 files. Run Prettier with --write to fix.

mvn clean verify works locally for me 🤷

Copy link
Member

@krisstern krisstern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Makes sense

Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Code looks good, not manually tested myself

@timja timja merged commit 5346234 into jenkinsci:master Dec 16, 2025
17 checks passed
@daniel-beck daniel-beck deleted the csp-compatibility branch December 16, 2025 11:27
</dialog>
</s:preview>
<s:code language="java" file="confirm.js" code="showConfirm()" executable="true"/>
<s:code language="java" file="confirm.js" code="showConfirm()" callback="showConfirm"/>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to future self (or anyone else who's super bored): Remove the code attribute here and in following tags as cleanup, they're no longer used. In general, file + code does not make sense anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace sample code (?) that's incompatible with CSP in Jenkins 2.539+

3 participants